
import { request } from "./request";
// 查看所有秒杀活动
export function getActivities(num_one_page, page_number) {
    return request({
        url: '/activity/getAllActivity',
        method: 'post',
        params: {
          num_one_page,
          page_number
        }
    })
}
// 登录
export function postLogin( admin_num, pwd ) {
  console.log(admin_num)
  console.log(pwd)
  return request({
      url: '/user/loginadmin',
      method: 'post',
      params:{
        admin_num,
        pwd
      }
  })
}
// 创建秒杀活动
export function createActivity( begintime, endtime, rules, amount, quantity, Activity_buy_max, Activity_type, admin_id, Activity_picture, Activity_name, rate ){
  return request({
    url: '/activity/CreateActivity',
    method: 'post',
    params: {
      begintime, 
      endtime, 
      rules, 
      amount, 
      quantity, 
      Activity_buy_max, 
      Activity_type, 
      admin_id, 
      Activity_picture,
      Activity_name,
      rate
    }
  })
}

//删除活动
export function deleteActivity(activity_id) {
  return request({
      url: '/activity/deleteActivity',
      method: 'post',
      params: {
        activity_id
      }
  })
}

export function getAllBuy(num_one_page, page_number) {
  return request({
      url: '/activity/getAllBuy',
      method: 'post',
      params: {
        num_one_page,
        page_number
      }
  })
}